package metier.Service;

import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import metier.entities.Etat;
import metier.sess.IEtatLocal;


@Stateless
@WebService
public class EtatService {
	@EJB(beanName="Etat")
	private IEtatLocal metier;
	
	
	@WebMethod
	public void addEtat(@WebParam(name="Intitule")String Initule,@WebParam(name="Statut")boolean Statut)
	{
		Etat etat=new Etat(Initule,Statut);
		metier.addEtat(etat);
	}
	
	@WebMethod
	public List<Etat> listEtats()
	{
		return metier.getAllEtats();
	}
	
	@WebMethod 
	public Etat getEtat(@WebParam(name="Id")Integer Id)
	{
		return metier.getEtat(Id);
	}
	
	
	@WebMethod
	public void UpdateEtat(@WebParam(name="Id")Integer Id,@WebParam(name="Intitule")String Intitule,@WebParam(name="Statut")boolean statut)
	{
	
		Etat etat=metier.getEtat(Id);
		etat.setIntitule(Intitule);
		etat.setStatus(statut);
		metier.updateEtat(etat);
		
	}
	
	
	@WebMethod
	public void DeleteEtat(@WebParam(name="Id")Integer Id)
	{
		metier.deleteEtat(Id);
	}
	

}
